package org.aphelie.chronicle.shaper;

import org.eclipse.emf.ecore.EObject;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class ChronicleShaperPlugin implements BundleActivator {
	
	private static BundleContext context;
	private static ChronicleShaper shaper;
	
	static BundleContext getContext() {
		return context;
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext bundleContext) throws Exception {
		ChronicleShaperPlugin.context = bundleContext;
		shaper = new ChronicleShaper();
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext bundleContext) throws Exception {
		shaper = null;
		ChronicleShaperPlugin.context = null;
	}
	
	public static ChronicleShaper getShaper() {
		return shaper;
	}
	
	public static void shape(EObject object) {
		getShaper().shape(object);
	}

}
